|
|
|
|
|
|
|
conjunction with Windows to take care of the mundane details of where the text is positioned on the screen, how it's retrieved from the user, and so on. Your Visual Basic program simply needs to be concerned with the text in the text box; the control itself takes care of the rest. |
|
|
|
|
|
|
|
|
Adding a Control to a Form |
|
|
|
|
|
|
|
|
In order for a Visual Basic program to use a control, that control must be placed on a form. For your Loan Calculator program, you begin by placing a TextBox control on the main form: |
|
|
|
|
|
|
|
|
1. Click the tool for the TextBox control in the Toolbox. If you aren't sure which is the TextBox control, let your mouse pointer pause over each in turn to see a ToolTip. |
|
|
|
|
|
|
|
|
2. Move the mouse pointer to the form. Note that the pointer changes to a crosshair, indicating that you're about to draw a control. |
|
|
|
|
|
|
|
|
3. Move the pointer to one corner of the area where you want to draw the control. |
|
|
|
|
|
|
|
|
4. Click and hold the left mouse button. |
|
|
|
|
|
|
|
|
5. Drag the mouse to where you want the diagonally opposite corner of the control. As you drag the mouse, notice that a sizing box appears from the first corner of the control's location (where you first clicked the mouse button) to the current mouse pointer location. This box indicates where the control will eventually be (see Figure 2.8). |
|
|
|
|
|
|
|
|
Figure 2.8
A ToolTip-type box appears showing
the actual dimensions of the control
in twips (a special unit of measurement
that will be covered later in the book). |
|
|
|
|
|
|
|
|
6. When you're satisfied with the size and shape of your control, release the mouse button. The control will be drawn on the form (see Figure 2.9). |
|
|
|
|
|
|
|
|
Figure 2.9
The completed text box appears on the
form and is selected (notice the sizing handles). |
|
|
|
|
|